
public class MainFNC {
 public static void main(String[] args) {
	
			
			Symbole a = new Symbole('a');
			Symbole b = new Symbole('b');
			SymboleNonTerminaux S = new SymboleNonTerminaux('S');
			SymboleNonTerminaux A = new SymboleNonTerminaux('A');
			SymboleNonTerminaux B = new SymboleNonTerminaux('B');
			ChomskyGrammar cg = new ChomskyGrammar();
			cg.addSymbolToAlphabet(a);
			cg.addSymbolToAlphabet(b);
			cg.addNonTerminalSymbol(A);
			cg.addNonTerminalSymbol(B);
			cg.setAxiom(S);
			cg.addProduction(A, a);
			cg.addProduction(A, S, S);
			cg.addProduction(B, b);
			cg.addProduction(B, S, S);
			cg.addProduction(S, A, A);
			cg.addProduction(S, B, B);
			System.out.println("false = "+cg.accept("baba"));
			System.out.println("true = "+cg.accept("aa"));
			System.out.println("true = "+cg.accept("bb"));
			System.out.println("true = "+cg.accept("aabbaabb"));
			System.out.println("false = "+cg.accept("aabbaa"));
			System.out.println("false = "+cg.accept("aabbaabbbb"));
			}

	
	
	
}

